package shopping;

import java.util.Scanner;

public class Project {
    private String name;
    private String kind;
    private double price;
    private int count;

    public Project() {
    }

    public Project(String name, String kind, double price, int count) {
        this.name = name;
        this.kind = kind;
        this.price = price;
        this.count = count;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }
    public String getKind() {
        return kind;
    }

    public void setPrice(double price) {
        this.price = price;
    }
    public double getPrice() {
        return price;
    }

    public void setCount(int count) {
        this.count = count;
    }
    public int getCount() {
        return count;
    }

    public void buy(){
        System.out.println("名称"+getName()+"\n种类"+getKind()+"\n价格"+getPrice()+"\n数量"+getCount());
        System.out.println("以上是它的商品信息,请输入要购买的数量");
        Scanner scBuy = new Scanner(System.in);
        int count=scBuy.nextInt();
        if(count<0||count>this.getCount()){
            System.out.println("非法数据.");
        } else{
            System.out.println("已收到"+count+"份"+this.name+"的订单");
        }
    }


}
